//
//  CinemaTableViewCell.m
//  豆瓣HW
//
//  Created by dllo on 15/11/23.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "CinemaTableViewCell.h"

@implementation CinemaTableViewCell

+ (CGFloat)heightWithStr:(NSString *)str
{
    CGRect frame = [str boundingRectWithSize:CGSizeMake(330, 1000) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:18.0] forKey:NSFontAttributeName] context:nil];
    return frame.size.height;
    
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    CGFloat height = [[self class] heightWithStr:self.labelAddress.text];
    CGRect frameL = self.labelAddress.frame;
    frameL.size.height = height;
    self.labelAddress.frame = frameL;

}

- (void)dealloc
{
    [_labelName release];
    [_labelAddress release];
    [_labelTelephone release];
    [_imageV release];
    [super dealloc];
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatSubTableViewCells];
    }
    return self;
}
- (void)creatSubTableViewCells
{
    
    self.imageV = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, [UIScreen mainScreen].bounds.size.width - 20, 150)];
    self.imageV.image = [UIImage imageNamed:@"bg_eventlistcell.png"];
    [self.contentView addSubview:self.imageV];
    [_imageV release];
    
    self.labelName = [[UILabel alloc] initWithFrame:CGRectMake(10, 5, 330, 40)];
//    self.labelName.backgroundColor = [UIColor blackColor];
    [self.imageV addSubview:self.labelName];
    [_labelName release];
    
    self.labelAddress = [[UILabel alloc] initWithFrame:CGRectMake(10, 55, 330, 40)];
//    self.labelAddress.backgroundColor = [UIColor blackColor];
    self.labelAddress.numberOfLines = 0;
    [self.imageV addSubview:self.labelAddress];
    [_labelAddress release];
    
    self.labelTelephone = [[UILabel alloc] initWithFrame:CGRectMake(10, 105, 330, 40)];
//    self.labelTelephone.backgroundColor = [UIColor blackColor];
    [self.imageV addSubview:self.labelTelephone];
    [_labelTelephone release];
    
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
